<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="text">
    </div>
    <script>
        var app = document.getElementById("app");
        var input = document.querySelector("input");
        var arr = []
        input.onkeyup = function (e) {
            // console.log(1);
            var value = this.value;
            if (e.keyCode == 13) {
                var p = document.createElement("p")
                p.innerHTML = this.value;
                if (arr.includes(this.vaule)) return;
                arr.push(this.value)
                app.appendChild(p)
                var todos = document.querySelectorAll("#app>p");
                this.value = ""
                    todos.forEach(item => {
                        item.onclick = function(){
                            app.removeChild(item)
                        }
    
                    })
                

            }
        }
    </script>
</body>

</html>